<template>
  <section v-if="name==='consigneeName'">
    {{row.distinctToAddress && row.distinctToAddress.length}}送<br />
    <template v-for="(item, index) in row && row.distinctToAddress">
      <span :key="index">
        {{item.address}}；</span>
    </template>
  </section>
  <section v-else-if="name === 'consignee'">
    <template v-for="(item, index) in row && row.distinctConsigneeName">
      <span :key="index"> {{ item }}；</span>
    </template>
  </section>
  <section v-else-if="['consignee', 'billConsignee'].includes(name)"
           :class="name === 'billConsignee' ? classFlag : ''">
    <el-tooltip placement="top">
      <div slot="content">
        {{ row.consigneeName }}<br />
        {{ row.toContactName }} {{ row.toContactMobile }}<br />
        <span class="area-class">
          {{ row.toProvince }}{{ row.toCity }}{{ row.toDistrict }} </span><br />
        {{ row.toAddress }}
      </div>
      <div>
        {{ row.consigneeName }} <br />
        {{ row.toProvince }}{{ row.toCity }}{{ row.toDistrict }}
      </div>
    </el-tooltip>
  </section>
  <section v-else-if="name==='orderList' && row"
           :class="`${classFlag} section-wrap`">
    {{ row.consigneeName }} <br />
    <span v-if="row.toAddress">
      {{ row.toAddress.contactName }} {{ row.toAddress.contactMobile }}<br />
      {{ row.toAddress.province }}{{ row.toAddress.city }}{{ row.toAddress.district }}<br />
      {{ row.toAddress.address }}
    </span>
  </section>
  <section v-else-if="name === 'cretReceiptList' && row.toAddress">
    {{ row.toAddress.province }} {{ row.toAddress.city }} {{ row.toAddress.district }}<br />
    {{ row.toAddress.address }}
  </section>
  <section v-else-if="name === 'orderImport'"
           :class="`${classFlag} section-wrap`">
    {{ row.consigneeName }} <br />
    {{ row.toContactName }} {{ row.toContactMobile }}<br />
    {{ row.toProvince }}{{ row.toCity }}{{ row.toDistrict }}{{ row.toAddress }}
  </section>
  <section v-else
           :class="`${classFlag} section-wrap`">
    {{ row.consigneeName }} <br />
    {{ row.toContactName }} {{ row.toContactMobile }}<br />
    <span class="area-class">
      <!-- :title="row.toProvince+row.toCity+row.toDistrict+row.toAddress" -->
      {{ row.toProvince }}{{ row.toCity }}{{ row.toDistrict }}
    </span><br />
    {{ row.toAddress }}
  </section>
</template>

<script>
export default {
  name: "ConsigneeInfo",
  props: {
    row: {
      type: Object,
      default: () => { }
    },
    name: {
      type: String,
      default: ''
    },
    classFlag: {
      type: String,
      default: ""
    }
  },
  data () {
    return {};
  }
};
</script>
<style scoped>
.section-wrap {
  width: 100%;
  display: -webkit-box;
  word-break: break-all;
  text-overflow: ellipsis;
  overflow: hidden;
  /* white-space: pre-line; */
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.area-class {
}
.red {
  color: var(--prev-color-text-red);
}
</style>
